<?php

require("pais.php");
require("conf.php");

$yhendus=new mysqli($host, $username, $password, $db_name);
$kask=$yhendus->prepare("SELECT nick, eesnimi, perenimi, makstud FROM m2ngurid WHERE avalik=1 ORDER BY eesnimi");
$kask->bind_result($nick,$eesnimi,$perenimi, $makstud);
$kask->execute();
echo"<table border='1'>
<tr>
<th>Nick</th>
<th>Eesnimi</th>
<th>Perekonnanimi</th>
<th>Makstud</th>
</tr>
";

while($kask->fetch()){
	if($makstud==0)
	{
		$maks="Ei";
	}
	else if($makstud==1) {
		$maks="Jah";
	}
	echo"
	<tr>
		<td>$nick</td>
		<td>$eesnimi</td>
		<td>$perenimi</td>
		<td>$maks</td>
		<tr>";
}
echo"</table>";
$yhendus->close();
?>